package laravel_generator;

import entity_model.Entity;
import entity_model.EntityModel;
import extractor.view.entities.EntitiesView;
import javafx.application.Application;
import javafx.stage.Stage;
import laravel.Laravel;
import laravel.mvc.EntityFacade;
import misc.files.File;

import java.util.ArrayList;
import java.util.List;

public class LaravelGenerator extends Application{

    public static void main(String...args) {
        launch(args);
    }

    @Override
    public void start(Stage stage) throws Exception {
        new EntitiesView();
    }

    public static void execute() {
        List<Entity> entities = new ArrayList<>(EntityModel.INSTANCE.ENTITY_MAP.values());

        for (Entity entity : entities)
            new EntityFacade(entity).createComponents();

        Laravel.ROUTES.save();
        Laravel.LEFT_MENU.save();

        for(File file : Laravel.FILES)
            file.save();
    }
}
